package com.kai.controller;


import com.kai.pojo.EmpJobData;
import com.kai.pojo.Result;
import com.kai.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;


    //json data数据 带{} 的 返回的是对象
    //             带[] 的 返回的是数组或者集合就行


    //统计员工职位信息
    @GetMapping("/empJobData")
    public Result empJobData(){

        log.info("统计员工职位信息");
         EmpJobData empJobData = reportService.empJobData();
         return Result.success(empJobData);
    }

    @GetMapping("/empGenderData")
    public Result empGenderData(){

        log.info("统计员工性别信息");
        List<Map<String, Object>> list = reportService.empGenderData();
        return Result.success(list);
    }

}
